package com.springcloud.common.web.config;

import org.springframework.context.annotation.Bean;

import java.util.concurrent.TimeUnit;

/**
 * <p>  </p>
 *
 * @author mori
 * @since 11/4/2019 3:06 PM
 */
public class FeignOkHttpConfiguration {

    @Bean
    public okhttp3.OkHttpClient okHttpClient() {
        int feignOkHttpReadTimeout = 60;
        int feignConnectTimeout = 60;
        int feignWriteTimeout = 120;
        return new okhttp3.OkHttpClient.Builder()
                .readTimeout(feignOkHttpReadTimeout, TimeUnit.SECONDS)
                .connectTimeout(feignConnectTimeout, TimeUnit.SECONDS)
                .writeTimeout(feignWriteTimeout, TimeUnit.SECONDS)
                .build();
    }
}
